/*
 * @Descripttion: 
 * @Author: yubo
 * @Date: 2022-08-30 17:28:15
 * @LastEditTime: 2022-08-30 17:42:35
 */

#include "TokenConstructor.h"

#ifdef _MSC_VER
#pragma comment(lib, "WS2_32.LIB")
#pragma comment(lib, "CRYPT32.LIB")
#pragma comment(lib, "./openssl-1.1.1b/lib/libcrypto.lib")
#pragma comment(lib, "./openssl-1.1.1b/lib/libssl.lib")

#endif
using namespace std;

const string TokenConstructor::token_pattern = "accountType=%c|loginType=%d|fundAccount=%s|timestamp=%s";

string TokenConstructor::token_construct(
	char account_type,
	int login_type,
	const std::string &fund_account,
	const std::string &time_stamp){
	char buf[2048] = { 0 };
	snprintf(buf, sizeof(buf), token_pattern.c_str(), account_type, login_type, fund_account.c_str(), time_stamp.c_str());
	string out(buf);
	return out;
}